package com.job.GaoYuXuan.Homework0707.JavaBean;

import java.util.Arrays;

/**
 * @author 盖
 * @version 1.0
 * @since 2022-07-08 16:41:47
 */
public class MyTool {
    public String name;
    public int age;
    public String major;
    public void Show(String name){
        System.out.println("你好！" + name + "，我是" + this.name + "，我" +age+ "岁。");
    }
    public float sort(int[] number){
        int sum = 0;
        Arrays.sort(number);
        for(int i = 0; i < number.length; i++){
            sum += number[i];
        }
        float aver = sum / number.length;
        if(aver >= number[number.length / 2]){
            return aver;
        }else{
            return number[number.length / 2];
        }
    }
}